function Pageview(collect){
    this.data = {};
    var pvSet = collect && collect.modConf && collect.modConf.pv || null;
    if (pvSet) {
        each(pvSet, function(val, key) {
            this.set(key, val);
        }, this);
    }
}

var PageviewPrototype = Pageview.prototype;
PageviewPrototype.name = "pageview";

PageviewPrototype.report = function(){
    var local = window.location;
    if (clientCollect.collectSubjects.stay) {
        // 自动发停留时间统计
        setTimeout(function(){
            clientCollect.collectSubjects.stay.reset();
            clientCollect.send("event", null, "stay");
        }, 50);
    }

    if (clientCollect.collectSubjects.scroll) {
        // 有滚动统计的话每次发 pv 前都重置一次
        clientCollect.collectSubjects.scroll.reset();
    }

    var data = {
        "url": local.href
        ,"title": document.title
    };

    each(this.data, function(val, key) {
        data[key] = isFunction(val) ? val(): val;
    });

    return data;
}

/**
 * 设置一个 pv 统计的默认字段及值
 * @param  {String} key 字段名
 * @param  {Mix}    val 字段值，支持适用函数动态返回
 */
PageviewPrototype.set = function(key, val) {
    if (key) {
        this.data[key] = val;
    }
}
clientCollect.add(Pageview);
